import request from '@/utils/request'

// 查询供应商档案列表
export function listBizSupplier (query) {
  return request({
    url: '/biz/bizSupplier/list',
    method: 'get',
    params: query
  })
}

export function listAllBizSupplier (query) {
  return request({
    url: '/biz/bizSupplier/allList',
    method: 'get',
    params: query
  })
}

// 查询供应商档案详细
export function getBizSupplier (id) {
  return request({
    url: '/biz/bizSupplier/' + id,
    method: 'get'
  })
}

// 新增供应商档案
export function addBizSupplier (data) {
  return request({
    url: '/biz/bizSupplier',
    method: 'post',
    data: data
  })
}

// 修改供应商档案
export function updateBizSupplier (data) {
  return request({
    url: '/biz/bizSupplier',
    method: 'put',
    data: data
  })
}

// 删除供应商档案
export function delBizSupplier (id) {
  return request({
    url: '/biz/bizSupplier/' + id,
    method: 'delete'
  })
}

// 校验供应商名称是否存在
export function checkSupplierNameUnique (id, supplierName) {
  if (id === undefined) {
    id = ''
  }
  return request({
    url: '/biz/bizSupplier/checkSupplierNameUnique/' + supplierName + '/' + id,
    method: 'get'
  })
}

// 导出供应商档案
export function exportBizSupplier (query) {
  return request({
    url: '/biz/bizSupplier/export',
    method: 'get',
    params: query
  })
}

// 获取初始化数据
export function getInitData (dictTypes) {
  return request({
    url: '/biz/bizSupplier/getInitData/' + dictTypes,
    method: 'get'
  })
}
